package org.dding.msc.service;

import java.io.IOException;
import java.util.logging.LogManager;
import java.util.logging.Logger;

import org.junit.Test;

import com.test.TestLogger;

public class LoggerService {

	public Logger logger = Logger.getLogger("org.dding.msc.service");
	static {
		System.setProperty("java.util.logging.manager", LoggerManager.class.getName());
		System.setProperty("java.util.logging.config.file",
				"D:/moduleeclipse/tip/trunk/test/org/dding/msc/service/logging1.properties");

	}

	public static void main(String[] args) {
		new LoggerService().testLogger();
		Logging logging = new Logging();
		for (String log : logging.getLoggerNames()) {
			System.out.println(log + ":" + logging.getLoggerLevel(log));
		}
	}

	@Test
	public void testLogger() {

		logger.finest("finest message");
		logger.fine("fine message");
		logger.info("info message");
		logger.warning("warning message");
		logger.severe("severe message");

		TestLogger lo = new TestLogger();
		lo.logger();
//		LogManager logManager = LogManager.getLogManager();
//		System.setProperty("java.util.logging.config.file",
//				"D:/moduleeclipse/tip/trunk/test/org/dding/msc/service/logging.properties");
//		try {
//			logManager.readConfiguration();
//		} catch (SecurityException e) {
//			e.printStackTrace();
//		} catch (IOException e) {
//			e.printStackTrace();
//		}
//
//		//		logger.setLevel(Level.ALL);
//
//		//		System.out.println("------------------------------------\n");
//		logger.info("new info message");
//		logger.fine("new fine message");
//		logger.finest("new finest message");
//		logger.warning("new warning message");
//		logger.severe("new severe message");

	}

}
